Pass changelog unmodified, let LogAgent swap the JIRA references#508
Pass changelog unmodified, let LogAgent swap the JIRA references#508antbob wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request modifies the backport agent to stop filtering out 'Resolves' and 'Related' lines from source changelogs and updates the log agent's instructions to replace JIRA references within those lines. Feedback indicates that these changes risk creating malformed changelogs with duplicate or missing 'Resolves' lines when multiple commits are combined, and that JIRA references in descriptive lines may not be correctly handled.
| if line not in seen: | ||
| seen.add(line) | ||
| collected_lines.append(line) |
There was a problem hiding this comment.
Removing the filtering of Resolves/Related lines while maintaining the seen deduplication logic can lead to malformed changelogs when multiple commits are combined. If different commits have different JIRA references, all of them will be collected. For example, combining two commits might result in a list like this being passed to the LogAgent:
- Fix feature A
- Resolves: RHEL-1
- Fix feature B
- Resolves: RHEL-2
When the LogAgent processes this with the instruction to "Only replace... with <JIRA_ISSUES>", it will likely produce multiple identical Resolves lines for the current JIRA (e.g., two - Resolves: RHEL-3 lines), which is incorrect for RPM changelogs. Consider either continuing to strip these lines here or updating the LogAgent instructions to handle consolidation.
| rephrase, summarize, or add to them. Only replace the Jira issue references | ||
| in any Resolves/Related lines with <JIRA_ISSUES>. |
There was a problem hiding this comment.
The updated instructions for the LogAgent when a source_changelog is provided introduce several risks:
- Missing Resolves line: If the source changelog doesn't happen to contain a
ResolvesorRelatedline, the agent is not explicitly instructed to add one, which could result in an invalid RHEL changelog entry. - Redundant lines: As noted in the
backport_agent.pyreview, combining multiple source commits can lead to multipleResolveslines. The "Only replace" instruction doesn't account for consolidating them into a single line. - Incomplete swapping: JIRA references within descriptive lines (e.g.,
- Fix bug (RHEL-123)) are not covered by the "Resolves/Related lines" restriction and will remain in the output, causing inconsistency.
Consider refining the instructions to ensure a single, consolidated Resolves line is present at the end, while still preserving the descriptive content.
Now the source changelog is passed through unmodified, and the LogAgent is told to only swap the JIRA issue references in Resolves/Related lines. This provides better changelog consistency based on our trials and also simplifies the logic making it less error prone. The downside is that the model can make a mistake when swapping JIRA references (if they are present) but that remains to be seen as so far it has behaved correctly on multiple trials.